package com.shambles.manage2.tkmapper.mapper;

import com.shambles.manage2.tkmapper.entity.SubscribeDetail;
import com.shambles.manage2.tkmapper.entity.SubscribeInformation;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.additional.insert.InsertListMapper;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface SubscribeDetailMapper extends Mapper<SubscribeDetail>, InsertListMapper<SubscribeDetail> {
    int findUpperLimit();

    /**
     * 查询预约表信息
     */
    @Select("select * from subscribe_information where id='${id}' and status=0 ")
    SubscribeInformation querySubscribeInfo(@Param("id") String id);

    /**
     * 查询预约明细类型和数量
     */
    @Select("select * from subscribe_detail where subscribe_guid='${guid}' ")
    List<SubscribeDetail> querySubscribeDetail(@Param("guid") String guid);

    /**
     * 查询图片地址
     */
    @Select("select b.image_url from subscribe_information a, photo b where a.guid = b.subscribe_guid and a.guid='${guid}'")
    List<String> queryImageUrl(@Param("guid") String guid);

    /**
     * 个人预约信息记录
     */
    @Select("select * from subscribe_information where subscribe_open_id='${openId}'")
    List<SubscribeInformation> queryPersonalInfo(@Param("openId")  String openId);


    List<SubscribeDetail> findBySubGuid(String guid);
}